package com.itbaima.csmall.business.controller;

import com.itbaima.csmall.business.service.BusinessService;
import com.itbaima.csmall.commons.pojo.order.dto.OrderAddDTO;
import com.itbaima.csmall.commons.restful.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>购买业务开始模块</p>
 *
 * @author Chen
 * @since 2023/2/17 15:59:59
 */
@Api(tags = "01. 业务触发模块")
@RequestMapping("/base/business")
@RestController
public class BusinessController {

    @Autowired
    private BusinessService businessService;

    /**
     * localhost:20000/base/business/buy
     */
    @ApiOperation("执行购买业务的触发")
    @PostMapping("/buy")
    public JsonResult<Void> buy(OrderAddDTO orderAddDTO) {
        businessService.buy(orderAddDTO);
        return JsonResult.ok("已触发购买业务");
    }

}
